//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    show:false,
    functions:false,
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  menu:function(){
    if(this.data.show){
      this.setData({
        show:false,
        functions:true
      })
    }else{
      this.setData({
        show:true,
        functions: true
      })
    }
  },
  onLoad: function () {
    
  },
  goScenicSpot:function(e){
    wx.navigateTo({
      url: '../scenicSpot/scenicSpotIndex/scenicSpot?id='+e.currentTarget.id
    })
  },
  goshopping: function (e) {
    wx.navigateTo({
      url: '../shoppingMall/shopMallHome/sp_home'
    })
  },
  goHotel: function (e) {
    wx.navigateTo({
      url: '../hotelSystem/hotelSystem/hotelSystem?id=' + e.currentTarget.id
    })
  },
  goHospital: function (e) {
    wx.navigateTo({
      url: '../medicalCenter/medicalCenter/medicalCenter?id=' + e.currentTarget.id
    })
  },
  navigateToPersonCenter:function(){
    wx.navigateTo({
      url: '../personCenter/personCenter',
    })
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo;
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  },
  introduce:function(){
    wx.navigateTo({
      url: '../introduce/introduce'
    })
  },
  phoneCall:function(){
    wx.makePhoneCall({
      phoneNumber: '0550-3701118' //仅为示例，并非真实的电话号码
    })
  },
  onShareAppMessage: function (res) {
    console.log(res)
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '桃花源',
      path: '/pages/index/index',
      success: function (res) {
        // 转发成功
        wx.showToast({
          title: '分享成功',
          icon: 'none'
        });
      },
      fail: function (res) {
        // 转发失败
        wx.showToast({
          title: '分享失败',
          icon: 'none'
        });
      }
    }
  }
})
